<?php
/**
 * Created by PhpStorm.
 * User: luo
 * Date: 2018/10/8
 * Time: 23:42
 */

namespace app\tools;


class Protocol
{
    const NAME = 'jiaju';

    public static function article($id, $url){
        return self::NAME.'://article?id='.$id.'&url='.$url;
    }

    public static function news($id, $url){
        return self::NAME.'://news?id='.$id.'&url='.$url;
    }

    public static function post($id){
        return self::NAME.'://post?id='.$id;
    }

    public static function pics($id){
        return self::NAME.'://pics?id='.$id;
    }

    public static function video($id){
        return self::NAME.'://video?id='.$id;
    }

    /**
     * 外链文章协议
     * @param $id
     * @param $url
     * @return string
     */
    public static function link($id, $url){
        return self::NAME.'://link?id='.$id.'&url='.$url;
    }

    public static function tag($id){
        return self::NAME.'://tag?id='.$id;
    }

    public static function subject($id){
        return self::NAME.'://subject?id='.$id;
    }

    public static function topic($id){
        return self::NAME.'://topic?id='.$id;
    }

    public static function user($id){
        return self::NAME.'://user?id='.$id;
    }

    public static function article_set($id){
        return self::NAME.'://article_set?id='.$id;
    }

    /**
     * 外链
     * @param $url
     * @return string
     */
    public static function url($url){
        if (!strstr($url,"http")) {
            $url = "http://".$url;
        }
        return self::NAME.'://webview?url='.$url;
    }
}